<?php

namespace App\Console\Commands\SiteLocation;

use App\Models\Wanggui\CustomerDepartmentClueRecordModel;
use Illuminate\Console\Command;

class UpdateClueRecordStatus extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'siteLocation:update-clue-record-status';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '更新线索记录状态脚本';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     */
    public function handle()
    {
        CustomerDepartmentClueRecordModel::query()
            ->where('preHaving', '<', time())
            ->where('status', CustomerDepartmentClueRecordModel::STATUS_FOLLOWING_UP)
            ->update([
                'status' => CustomerDepartmentClueRecordModel::STATUS_OVERDUE,
            ]);
    }
}
